<template>
    <div class="app-container">
        <div class="head-container">
            <!-- 搜索 -->
            <el-input v-model="listQuery.Filter" clearable size="small" placeholder="搜索..." style="width: 200px;"
                class="filter-item" @keyup.enter.native="handleFilter" />
            <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="handleFilter">搜索
            </el-button>
            <div style="padding: 6px 0">
                <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="handleCreate">新增
                </el-button>
                <el-button class="filter-item" size="mini" type="success" icon="el-icon-edit" @click="handleUpdate()">修改
                </el-button>
                <el-button slot="reference" class="filter-item" type="danger" icon="el-icon-delete" size="mini"
                    @click="handleDelete()">删除</el-button>
                <el-button class="filter-item" type="warning" icon="el-icon-s-check" size="mini"
                    @click="handleCheck()">审核</el-button>
            </div>
        </div>
        <el-dialog :visible.sync="dialogFormVisible" :close-on-click-modal="false" @close="cancel()" :title="formTitle">
            <h2 style="margin: auto;text-align: center;">还货单</h2>
            <el-form ref="form" :model="form" :rules="rules" size="medium" label-width="100px">
                <h3>基本信息</h3>
                <el-row>
                    <el-col :span="5">
                        <el-form-item label="关联借货单">
                            <el-input v-model="form.conUnit" clearable :style="{ width: '100%' }">
                                <template slot="append">
                                    <i class="el-icon-search" @click="getUserInfo()"></i>
                                </template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="单据编号">
                            <el-input v-model="form.rNum" clearable :style="{ width: '100%' }" :disabled="true"
                                placeholder="保存后自动生成">
                            </el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="5">
                        <el-form-item label="单据主题">
                            <el-input v-model="form.rTitle" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="还货人员">
                            <el-input v-model="form.rPeo" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>

                </el-row>
                <el-row>

                    <el-col :span="5">
                        <el-form-item label="经手库管">
                            <el-input v-model="form.rHand" clearable :style="{ width: '100%' }"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="关联项目">
                            <el-input v-model="form.rConP" clearable :style="{ width: '100%' }">
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="还货日期">
                            <el-date-picker v-model="form.rTime" type="date" placeholder="选择日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>

                    <el-col :span="18">
                        <el-form-item label="备注">
                            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.rDesc">
                            </el-input>
                        </el-form-item>
                    </el-col>

                </el-row>

            </el-form>



            <div>

                <div>
                    <div>
                        <h2>还货明细</h2>
                        <el-button size="small" @click="addRow">新增</el-button>
                    </div>
                    <!--设置的表单-->
                    <el-form :model="studentData" ref="data" label-width="auto">
                        <el-table border :header-cell-style="{ 'text-align': 'center' }"
                            :cell-style="{ 'text-align': 'center' }" :data="studentData" ref="table"
                            style="width: 100%">

                            <el-table-column align="center" label="产品名称">
                                <template slot-scope="scope">
                                    <!--表格里面嵌套表单-->
                                    <el-form-item :prop="scope.$index + '.rpName'"
                                        :rules="{ required: true, message: '产品名称不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rpName" autocomplete="off"
                                            size="small" placeholder="产品名称"></el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>

                            <el-table-column align="center" label="编号">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rpNum'"
                                        :rules="{ required: true, message: '编号不能为空', trigger: 'blur' }">

                                        <el-input v-model="studentData[scope.$index].rpNum" autocomplete="off"
                                            size="small" placeholder="编号"></el-input>

                                    </el-form-item>
                                </template>
                            </el-table-column>

                            <el-table-column align="center" label="型号">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rsNum'"
                                        :rules="{ required: true, message: '型号不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rsNum" autocomplete="off"
                                            size="small" placeholder="型号"></el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>

                            <el-table-column align="center" label="单位">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rUnit'"
                                        :rules="{ required: true, message: '单位不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rUnit" autocomplete="off"
                                            size="small" placeholder="单位"></el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="数量">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rNum'"
                                        :rules="{ required: true, message: '数量不能为空', trigger: 'blur' }">

                                        <el-input v-model="studentData[scope.$index].rNum" autocomplete="off"
                                            size="small" type='number' placeholder="保存后自动生成"></el-input>


                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="计划还款日期">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rTime'"
                                        :rules="{ required: true, message: '数量不能为空', trigger: 'blur' }">


                                        <el-date-picker v-model="studentData[scope.$index].rTime" type="date"
                                            placeholder="选择日期">
                                        </el-date-picker>

                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="出库仓库">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rBase'"
                                        :rules="{ required: true, message: '出库仓库不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rBase" autocomplete="off"
                                            size="small" placeholder="出库仓库">

                                        </el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="批号">
                                <template slot-scope="scope">
                                    <!--表格里面嵌套表单-->
                                    <el-form-item :prop="scope.$index + '.rph'"
                                        :rules="{ required: true, message: '批号不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rph" autocomplete="off"
                                            size="small" placeholder="批号"></el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="包装方式">
                                <template slot-scope="scope">
                                    <el-form-item :prop="scope.$index + '.rPack'"
                                        :rules="{ required: true, message: '包装方式不能为空', trigger: 'blur' }">
                                        <el-select v-model="studentData[scope.$index].rPack" placeholder="请选择">
                                            <el-option label="纸箱包装" value="纸箱包装"></el-option>
                                            <el-option label="塑料包装" value="塑料包装"></el-option>
                                            <el-option label="常规包装" value="常规包装"></el-option>
                                            <el-option label="其他" value="其他"></el-option>
                                        </el-select>




                                    </el-form-item>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="备注">
                                <template slot-scope="scope">
                                    <!--表格里面嵌套表单-->
                                    <el-form-item :prop="scope.$index + '.rDesc'"
                                        :rules="{ required: true, message: '备注不能为空', trigger: 'blur' }">
                                        <el-input v-model="studentData[scope.$index].rDesc" autocomplete="off"
                                            size="small" placeholder="备注"></el-input>
                                    </el-form-item>
                                </template>
                            </el-table-column>


                            <el-table-column fixed="right" label="操作" width="100">
                                <template slot-scope="scope">
                                    <el-button @click="handleDeleteRow(studentData[scope.$index])" type="text"
                                        size="small">删除</el-button>
                                </template>
                            </el-table-column>

                        </el-table>
                    </el-form>
                </div>

                <div slot="footer" class="dialog-footer" style="margin-bottom: 10px">
                    <el-button size="mini" @click="submit">提交</el-button>
                    <el-button size="mini" @click="resetForm()">重置</el-button>
                </div>
            </div>
            <h2>附件&nbsp;&nbsp;</h2>

            <el-form>
                <el-upload action="/your-upload-api-endpoint" :on-preview="handlePreview" :on-remove="handleRemove"
                    :file-list="fileList" list-type="text" multiple>
                    <el-button size="small" type="primary">批量上传</el-button><br />

                </el-upload>
                <el-table :data="tableData" style="width: 100%" border>
                    <el-table-column prop="name" label="文件名称" width="180"> </el-table-column>
                    <el-table-column prop="name" label="文件大小" width="180"> </el-table-column>
                    <el-table-column prop="date" label="上传人" width="180"> </el-table-column>
                    <el-table-column prop="name" label="上传时间" width="180"> </el-table-column>
                </el-table>
            </el-form>

            <el-dialog :visible.sync="dialogUserInfo" style="width: 100%;height: auto;" :close-on-click-modal="false"
                :title="formTitle">
                <el-button class="filter-item" size="mini" type="success" @click="saveUserInfo">确定</el-button>
                <el-row>
                    <el-col :span="4">
                        <!-- <el-tree :data="orgData" :load="getOrgs" :props="defaultProps" :expand-on-click-node="false"
                            lazy @node-click="handleNodeClick" style="margin-top:15px" /> -->
                    </el-col>
                    <el-col :span="20">
                        <el-table ref="multipleTable" v-loading="listLoading" :data="userList" size="small"
                            style="width: 100%;" @sort-change="sortChange" @selection-change="handleSelChangeUser"
                            @row-click="handleRowClick">
                            <el-table-column type="selection" width="44px"></el-table-column>
                            <el-table-column label="项目名称" prop="proName" sortable="custom" align="center" width="150px">
                                <template slot-scope="{row}">
                                    <span class="link-type" @click="handleUpdate(row)">{{ row.proName }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="项目编号" prop="orgIdToName" align="center">
                                <template slot-scope="scope">
                                    <span>{{ scope.row.organizationNames }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="日期" prop="email" sortable="custom" align="center" width="200px">
                                <template slot-scope="scope">
                                    <span>{{ scope.row.email }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="电话" prop="phoneNumber" sortable="custom" align="center"
                                width="200px">
                                <template slot-scope="scope">
                                    <span>{{ scope.row.phoneNumber }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="操作" align="center" width="125">
                                <template slot-scope="{row}">
                                    <el-button type="primary" size="mini" @click="handleUpdate(row)"
                                        v-permission="['AbpIdentity.Users.Update']" icon="el-icon-edit" />
                                    <el-button type="danger" size="mini" @click="handleDelete(row)"
                                        :disabled="row.userName === 'admin'" v-permission="['AbpIdentity.Users.Delete']"
                                        icon="el-icon-delete" />
                                </template>
                            </el-table-column>
                        </el-table>
                        <pagination v-show="totalCount > 0" :total="totalCount" :page.sync="page"
                            :limit.sync="listQuery.MaxResultCount" @pagination="getList" />
                    </el-col>
                </el-row>

            </el-dialog>





            <div slot="footer">
                <el-button size="small" type="text" @click="cancel">取消</el-button>
                <el-button size="small" v-loading="formLoading" type="primary" @click="save">确认</el-button>
            </div>
        </el-dialog>
        <div>
            <el-dialog title="出库信息" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
                <span>
                    <div class="app-container">
                        <div class="head-container">


                            <div style="padding: 6px 0">
                                <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus"
                                    @click="handleCreate">新增
                                </el-button>
                                <el-button class="filter-item" size="mini" type="success" icon="el-icon-edit"
                                    @click="handleUpdate()">修改
                                </el-button>
                                <el-button slot="reference" class="filter-item" type="danger" icon="el-icon-delete"
                                    size="mini" @click="handleDelete()">删除</el-button>
                                <el-button class="filter-item" type="warning" icon="el-icon-s-check" size="mini"
                                    @click="handleCheck()">审核</el-button>
                            </div>
                        </div>
                        <el-dialog :visible.sync="dialogFormVisible" :close-on-click-modal="false" @close="cancel()"
                            :title="wformTitle">
                            <el-form ref="form" :model="form" :rules="rules" size="medium" label-width="100px">
                                <el-form-item label="仓库编号" prop="wId">
                                    <el-input v-model="form.deliId" placeholder="请输入名称" clearable
                                        :style="{ width: '100%' }"></el-input>
                                </el-form-item>
                                <el-form-item label="仓库名称" prop="wName">
                                    <el-input v-model="form.dName" placeholder="请输入描述" clearable
                                        :style="{ width: '100%' }">
                                    </el-input>
                                </el-form-item>

                            </el-form>
                            <div slot="footer">
                                <el-button size="small" type="text" @click="cancel">取消</el-button>
                                <el-button size="small" v-loading="wformLoading" type="primary"
                                    @click="save">确认</el-button>
                            </div>
                        </el-dialog>
                        <el-table ref="multipleTable" v-loading="listLoading" :data="list" size="small"
                            style="width: 90%;" @sort-change="sortChange" @selection-change="handleSelectionChange"
                            @row-click="handleRowClick">
                            <el-table-column type="selection" width="44px"></el-table-column>
                            <el-table-column label="发货方式编号" prop="wId" align="center" />
                            <el-table-column label="发货方式名称" prop="wName" align="center" />

                            <el-table-column label="操作" align="center">
                                <template slot-scope="{row}">
                                    <el-button type="primary" size="mini" @click="handleUpdate(row)"
                                        icon="el-icon-edit" />
                                    <el-button type="danger" size="mini" @click="handleDelete(row)"
                                        icon="el-icon-delete" />
                                </template>
                            </el-table-column>
                        </el-table>
                        <!-- <pagination v-show="wtotalCount > 0" :total="wtotalCount" :page.sync="page" :limit.sync="wlistQuery.MaxResultCount"
            @pagination="getList" /> -->
                    </div>

                </span>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="dialogVisible = false">取 消</el-button>
                    <el-button type="primary" @click="dialogVisible = true">确 定</el-button>
                </span>
            </el-dialog>
        </div>
        <el-table ref="multipleTable" v-loading="listLoading" :data="list" size="small" style="width: 90%;"
            @sort-change="sortChange" @selection-change="handleSelectionChange" @row-click="handleRowClick">
            <el-table-column type="selection" width="44px"></el-table-column>
            <el-table-column label="单据编号" prop="rNum" align="center" />
            <el-table-column label="还货主题" prop="rTitle" align="center" />
            <el-table-column label="还货人员" prop="rPeo" align="center" />
            <el-table-column label="还货日期" prop="rTime" align="center" />
            <el-table-column label="经手库管" prop="rHand" align="center" />
            <el-table-column label="关联借货单" prop="conUnit" align="center" />

            <el-table-column label="关联项目" prop="rConP" align="center" />
            <el-table-column label="操作" align="center">
                <template slot-scope="{row}">
                    <el-button type="primary" size="mini" @click="handleUpdate(row)" icon="el-icon-edit" />
                    <el-button type="danger" size="mini" @click="handleDelete(row)" icon="el-icon-delete" />
                </template>
            </el-table-column>
        </el-table>
        <pagination v-show="totalCount > 0" :total="totalCount" :page.sync="page" :limit.sync="listQuery.MaxResultCount"
            @pagination="getList" />
    </div>


</template>
<script>
import Pagination from "@/components/Pagination";
import permission from "@/directive/permission/index.js";
import { cloneDeep } from "lodash";


export default {


    name: 'Book',
    components: {
        Pagination
    },



    directives: {
        permission
    },
    props: [],
    data() {
        return {
            //新增行
            studentData: [],
            dialogUserInfo: false,

            form: {
                id: null,
                conUnit: null,
                rNum: null,
                rTitle: null,
                rPeo: null,
                rTime: null,
                rHand: null,
                rConP: null,
                rDesc: null,
                createOrUpdateRGoodDto: []

            },
            rules: {
                pName: [{
                    required: true,
                    message: '请输入名称',
                    trigger: 'blur'
                }],

            },


            list: [],
            wlist: [],
            totalCount: 0,
            listLoading: true,
            wlistLoading: true,
            warelist: true,
            formLoading: false,
            listQuery: {
                Filter: '',
                Sorting: '',
                SkipCount: 0,
                MaxResultCount: 10
            },
            page: 1,
            dialogFormVisible: false,

            multipleSelection: [],
            formTitle: '',
            isEdit: false,





        }
    },
    computed: {},
    watch: {},
    created() {
        this.getList()
        this.getWareList()

    },
    mounted() { },
    methods: {
        handleSelChangeUser(val) {
            this.form.IPro = val[0].proName;
        },
        saveUserInfo() {
            this.dialogUserInfo = false;
        },
        getUserInfo() {
            this.dialogUserInfo = true;
            this.isEdit = false;
            this.dialogFormVisible = true;

            this.formTitle = "用户";
            this.$axios.gets("/api/business/produce?Filter=&Sorting=&SkipCount=0&MaxResultCount=10")
                .then((response) => {
                    this.userList = response.items;
                });
        },
        getWareListStatus(items, ids) {
            this.$axios.posts('api/business/workflow/node-status', ids).then(response => {
                items.forEach(element => { response.items.filter((i) => { if (i.entityId === element.id) { element.status = i.status; element.nodeId = i.nodeId; element.nodeStatus = i.nodeName } }) })
                this.wlist = items
                this.wlistLoading = false;
                this.listLoading = true;
            });
        },
        getWareList() {
            this.wlistLoading = true;
            this.listLoading = false;
            this.wlistQuery.SkipCount = (this.page - 1) * this.wlistQuery.MaxResultCount;
            this.$axios.gets('/api/business/ware', this.wlistQuery).then(response => {
                this.wtotalCount = response.wtotalCount;
                this.getListStatus(response.items, response.items.map(_ => _.id))
            });
        },

        getListStatus(items, ids) {
            this.$axios.posts('api/business/workflow/node-status', ids).then(response => {
                items.forEach(element => { response.items.filter((i) => { if (i.entityId === element.id) { element.status = i.status; element.nodeId = i.nodeId; element.nodeStatus = i.nodeName } }) })
                this.list = items
                this.listLoading = false;
                this.wlistLoading = true;
            });
        },
        getList() {
            this.listLoading = true;
            this.wlistLoading = true;
            this.listQuery.SkipCount = (this.page - 1) * this.listQuery.MaxResultCount;
            this.$axios.gets('/api/business/rgood', this.listQuery).then(response => {
                this.totalCount = response.totalCount;
                this.getListStatus(response.items, response.items.map(_ => _.id))
            });
        },

        fetchData(id) {
            this.$axios.gets('/api/business/rgood/' + id).then(response => {
                this.form = response;
            });
        },
        /**
       * 新增行
       */
        addRow() {
            let index = this.studentData.length;
            this.studentData.push({
                key: index,
                rpName: null,
                rpNum: null,
                rsNum: null,
                rUnit: null,
                rNum: null,
                rTime: null,
                rBase: null,
                rph: null,
                rPack: null,
                rDesc: null,

            });
        },

        /**
         * 删除行
         * @param row
         */
        handleDeleteRow(row) {
            let datas = this.studentData;
            for (var i = 0; i < datas.length; i++) {
                if (datas[i].key == row.key) {
                    datas.splice(i, 1);
                }
            }
        },

        /**
         * 提交
         */
        submit() {
            this.$refs["data"].validate(valid => {
                //valid为true，表示表单都已经验证通过，若为false，说明存在表单验证失败
                if (valid) {
                    save(this.studentData).then(response => {
                        this.$message({
                            message: '提交成功',
                            type: 'success'
                        });
                    });
                }
            });
        },



        handleFilter() {
            this.page = 1;
            this.getList();
        },
        handleCreate() {
            this.formTitle = '新增图书';
            this.isEdit = true;
            this.dialogFormVisible = true;
            this.dialogVisible = false;
        },
        handleDelete(row) {
            var params = [];
            let alert = '';
            if (row) {
                params.push(row.id);
                alert = row.pName;
            }
            else {
                if (this.multipleSelection.length === 0) {
                    this.$message({
                        message: '未选择',
                        type: 'warning'
                    });
                    return;
                }
                this.multipleSelection.forEach(element => {
                    let id = element.id;
                    params.push(id);
                });
                alert = '选中项';
            }
            this.$confirm('是否删除' + alert + '?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$axios.posts('/api/business/rgood/delete', params).then(response => {
                    this.$notify({
                        title: '成功',
                        message: '删除成功',
                        type: 'success',
                        duration: 2000
                    });
                    this.getList();
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        handleCheck() {
            if (this.multipleSelection.length === 0) {
                this.$message({
                    message: '未选择',
                    type: 'warning'
                });
                return;
            }
            if (this.multipleSelection.length > 1) {
                this.$message({
                    message: '暂不支持批量审核',
                    type: 'warning'
                });
                return;
            }
            this.$confirm('是否审核所选项?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$axios.puts('api/business/workflow/do/' + this.multipleSelection[0].id, { data: JSON.stringify(this.multipleSelection[0]) }).then(response => {
                    this.$notify({
                        title: '成功',
                        message: '审核成功',
                        type: 'success',
                        duration: 2000
                    });
                    this.getList();
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消审核'
                });
            });
        },
        findFlow(row) {
            this.$router.push({ path: "/tool/flowDisplay/" + row.nodeId });
        },
        handleUpdate(row) {
            this.formTitle = '修改图书';
            this.isEdit = true;
            if (row) {
                this.fetchData(row.id);
                this.dialogFormVisible = true;
            }
            else {
                if (this.multipleSelection.length != 1) {
                    this.$message({
                        message: '编辑必须选择单行',
                        type: 'warning'
                    });
                    return;
                }
                else {
                    this.fetchData(this.multipleSelection[0].id);
                    this.dialogFormVisible = true;
                    this.dialogVisible = false;
                }
            }
        },
        save() {

            //数组与对象转换
            let goodList = [];
            this.studentData.forEach(element => {
                goodList.push({
                    id: element.id,
                    rpName: element.rpName,
                    rpNum: element.rpNum,
                    rsNum: element.rsNum,
                    rUnit: element.rUnit,
                    rNum: element.rNum,
                    rTime: element.rTime,
                    rBase: element.rBase,
                    rph: element.rph,
                    rPack: element.rPack,
                    rDesc: element.rDesc,
                });
            });
            this.form.createOrUpdateRGoodDto = goodList;

            console.log(this.form)







            this.$refs.form.validate(valid => {
                if (valid) {
                    this.formLoading = true;
                    this.form.roleNames = this.checkedRole;
                    if (this.isEdit) {
                        this.$axios.posts('/api/business/rgood/data-post', this.form).then(response => {
                            this.formLoading = false;
                            this.$notify({
                                title: '成功',
                                message: '更新成功',
                                type: 'success',
                                duration: 2000
                            });
                            this.dialogFormVisible = false;
                            this.getList();
                        }).catch(() => {
                            this.formLoading = false;
                        });
                    }
                    else {


                        this.$axios.posts('/api/business/rgood/data-post', this.form).then(response => {
                            this.wformLoading = false;
                            this.$notify({
                                title: '成功',
                                message: '新增成功',
                                type: 'success',
                                duration: 2000
                            });
                            this.dialogFormVisible = false;
                            this.getList();
                        }).catch(() => {
                            this.formLoading = false;
                        });
                    }
                }
            });
        },
        sortChange(data) {
            const {
                prop,
                order
            } = data;
            if (!prop || !order) {
                this.handleFilter();
                return;
            }
            this.listQuery.Sorting = prop + ' ' + order;
            this.handleFilter();
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        handleRowClick(row, column, event) {
            this.$refs.multipleTable.clearSelection();
            this.$refs.multipleTable.toggleRowSelection(row);
        },



        cancel() {
            this.form = Object.assign({}, defaultForm);
            this.dialogFormVisible = false;
            this.$refs.form.clearValidate();
        },
        GetWare() {
            this.formTitle = '新增';
            this.isEdit = false;
            this.dialogFormVisible = false;
            this.dialogVisible = true;
        },

    }

}

</script>
<style></style>
